package com.myApp.server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import com.myApp.client.MyService;

import java.util.Date;


/**
 * <p>Title: MyServiceImpl</p>
 * <p>Description: RPC Remote service implementation (e.g. a servlet class)</p>
 *
 * @author Louis Botterill
 * @version 1.0
 *
 * Date         Author  Description
 * 10-03-2008   LB      Initial template version
 */
public class MyServiceImpl  extends RemoteServiceServlet implements MyService 
{
    /**
     * Implement the RPC method as defined in the interface...
     */
    public String myMethod(String param1)
    {
        if (param1.length() < 1)
        {
            throw new IllegalArgumentException("Invalid parameter");
        }
        
        StringBuffer buf = new StringBuffer("Received: '");
        
        Date date = new Date();
        
        String serverInfo = this.getServletContext().getServerInfo();
        
        buf.append(param1);
        buf.append("' - at:");
        buf.append(date.toString());
        buf.append(" - server info");
        buf.append(serverInfo);
        
        return buf.toString();
    }
}

